package drds.configuration.db.datasource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;


public class DataSourceContext {


    //
    private String dataSourceId;
    private DataSourceConfig dataSourceConfig;
    private DataSource dataSource;


    //

    public DataSourceConfig getDataSourceConfig() {
        return dataSourceConfig;
    }

    public void setDataSourceConfig(DataSourceConfig dataSourceConfig) {
        this.dataSourceConfig = dataSourceConfig;

    }

    public DataSource getDataSource() {
        return dataSource;
    }

    //
    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }
    //


    public String getDataSourceId() {
        return dataSourceId;
    }

    public void setDataSourceId(String dataSourceId) {
        this.dataSourceId = dataSourceId;
    }

    //


    public Connection getConnection() throws SQLException {

        return getDataSource().getConnection();
    }
}
